package main

import (
	"net/http"
	"os"
	"io/ioutil"
)

func main() {

	http.HandleFunc("/list/", func(write http.ResponseWriter, require *http.Request) {
		path := require.URL.Path[len("/list/"):]

		file, err := os.Open(path)
		if err != nil {
			panic(err)
		}
		defer file.Close()

		all , err := ioutil.ReadAll(file)
		//defer os.Exit(1)
		if err != nil {
			panic(err)
		}
		write.Write(all)

	})
	err := http.ListenAndServe(":8080", nil)
	if err != nil {
		panic(err)
	}
}
